#!/bin/sh
. /etc/profile
. /etc/nap.conf

if [ "$1" = "" ]
then
	echo need a song
	return
fi

madopts=--tty-control
madplayfifo

echo "$1" | grep http >/dev/null 2>&1
if [ $? -eq 0 ] 
then
	url=`echo $1 | sed -e 's/ /%20/g'`
	wget -q -O - "$url" | madplay $madopts -
else
	madplay $madopts "$1"
fi
